#!/bin/bash

# EbbFlow Local Test with Paillier Encryption
# This script starts N nodes with Paillier encryption enabled

N=6

# Clean old logs
rm -rf logs
mkdir -p logs

echo "Starting $N nodes with Paillier encryption..."

# Start all nodes in the background
for i in $(seq 0 $((N-1))); do
    ./adkr_node -id $i \
        -hosts hosts.json \
        -paillier-pub paillier_pub.json \
        -paillier-priv paillier_priv.json \
        > logs/node_$i.log 2>&1 &
    echo "Started node $i (PID: $!)"
done

echo ""
echo "All $N nodes started with Paillier encryption!"
echo "Logs are in logs/ directory"
echo ""
echo "To view logs in real-time:"
echo "  tail -f logs/node_0.log"
echo ""
echo "To check node status:"
echo "  ps aux | grep adkr_node"
echo ""
echo "To stop all nodes:"
echo "  pkill -f adkr_node"

